const app = getApp()
Page({
    data:{ 
       info:{},
	   button1:false,
	   button2:true
	},
	onLoad:function(options){
		app.request('/api/Parking/getStopInfo', {tradeid:options.tradeid}, function(res){
			if(res.code == '0'){
				//更新数据
				that.setData({
					info:res.data
				});
			}else{
				wx.showToast({
					title:res.msg,
					icon:'none'
				})
			}
		});
    },
	changePayType:function(e){
		if(e.detail.value == 2){
			this.setData({ 
				button1:true,
				button2:false
			})
		}else{
			this.setData({ 
				button1:false,
				button2:true
			})
		}
	},
	pay:function(){
		var that = this;
		app.request('/api/Parking/pointPay', {tradeid:that.data.info.tradeid}, function(res){
			wx.showToast({
				title:res.msg,
				icon:'none'
			})
			if(res.code == '0'){
				setTimeout(function(){
					wx.redirectTo({
						url:'/pages/parkrecord/parkrecord'
					})
				}, 1500);
			}
		});
	}
})
